# 面向对象
# 封装
# 继承
# 多态

# 私有成员
# 以__开头，不管是成员变量还是成员方法
# class Phone:
#     __current_voltage = 0.5  # 当前手机电压
#     def __keep_single_core(self):
#         print("让cpu以单核模式运行")
#
#     def call_by_5g(self):
#         if self.__current_voltage >= 1:
#             print("5g通话已经开启")
#         else:
#             self.__keep_single_core()
#             print("电量不足，无法使用5g通话，并已设置为单核运行进行省电！")
#
# phone = Phone()
# # phone.__keep_single_core()
# # print(phone.__current_voltage)
# phone.call_by_5g()


# 案例
class Phone():
    __is_5g_enable = True
    def __check_5g(self):
        if self.__is_5g_enable == True:
            print("5g开启")
        else:
            print("5g关闭，使用4g网络")

    def call_by_5g(self):
        self.__check_5g()
        print("正在通话中")


phone = Phone()
phone.call_by_5g()